var url = 'http://127.0.0.1:8089/littlehu/selectByPage';
var pageCount = 1;
var data = {
    pageNum : pageCount ,
    pageSize : 30
}
$.axspost( url , data , function(data) {
    console.log(data);
    if(data.code == 0 && data.data.length > 0){
        pageCount +=1;
        const bean = data.data;
        let els = '';
        for(let index = 0 ; index < bean.length ; index++){
            const element = bean[index];
            els+=createTemplate(element);
        }
        $('#blog_list').html(els)
    }
} , function(data) {
    console.log(data)
});

function createTemplate(element){
    console.log(element)
    const timedate = fromdate(element.pulishTime);
    return `<li>
        <h3 class="blogtitle"><span><a  href="${element.link}" title="css3" target="_blank"  class="classname">${element.author}</a></span><a  href="${element.link}" target="_blank" >${element.title}</a></h3>
        <div class="autor"><span class="lm f_l"></span><span class="dtime f_l">${timedate}</span><span class="viewnum f_l">浏览（<a href="/">1429</a>）</span><span class="f_r"><a href="${element.link}" class="more">阅读原文>></a></span></div>
        <div class="line"></div>
      </li>`
}

function fromdate(strtime){
    var date = new Date(strtime);
    Y = date.getFullYear() + '-';
    M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    D = date.getDate() + ' ';
    h = date.getHours() + ':';
    m = date.getMinutes() + ':';
    s = date.getSeconds();
    return (Y+M+D+h+m+s);

}